package com.easy;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by Lxk on 2019/8/24.
 */
public class Solution575 {

    public int distributeCandies(int[] candies) {
        if (candies == null || candies.length == 0) {
            return 0;
        }
        Set<Integer> set = new HashSet<>();
        for (Integer val : candies) {
            set.add(val);
        }
        return set.size() > candies.length / 2 ? candies.length / 2 : set.size();
    }

}
